package com.lzw.breezeNovel.webApp.controller.comic;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.webApp.service.comic.ComicHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.comic
 * @date 2025/3/18
 * @description 保存浏览记录的控制类
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/comic/history")
public class ComicHistoryController {

  /**
   * 注入service
   */
  @Autowired
  private ComicHistoryService comicHistoryService;

  /**
   * 保存浏览记录
   */
  @RequestMapping("/save")
  public Result save(@RequestParam Long comicId, @RequestParam Long orderNum) {
    comicHistoryService.save(comicId, orderNum);
    return Result.ok();
  }

  /**
   * 获取浏览记录
   */
  @RequestMapping("/get")
  public Result get(@RequestParam Long comicId) {
    Long orderNum = comicHistoryService.get(comicId);
    return Result.ok(orderNum);
  }

}
